package hibernate;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Restrictions;

import bean.PhotoBean;

public class PhotoRepository extends GenericRepository<PhotoBean, Integer> {
	
	public PhotoBean GetById(int id){
		Session s = HelperSessionFactory.getSession();
		Transaction trans = s.beginTransaction();
		Criteria criteria = s.createCriteria(PhotoBean.class).add(Restrictions.eq("id", id));
		PhotoBean photo = (PhotoBean) criteria.uniqueResult();
		trans.commit();
		return photo;
	}
	
	
}
